package com.mogu.blogs.service.impl;

import com.mogu.blogs.mapper.ArchiveMapper;
import com.mogu.blogs.service.ArchiveService;
import com.mogu.entity.TBlog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;

/**
 * Created by Papa on 2020/6/18.
 */
@Service
public class ArchiveServiceImpl implements ArchiveService {
@Autowired
ArchiveMapper archiveMapper;
    @Override
    public TBlog getArticleByMonth(String monthDate) {
        TBlog tBlog = archiveMapper.getBlogByMonth(monthDate);
//        Map<String, List<TBlog>> map = new HashMap<>();
        System.out.println(tBlog);
//        TBlog tBlog=new TBlog();
//        Date createTime = tBlog.getCreateTime();
//        HttpServletRequest request=null;
        String month = new SimpleDateFormat("yyyy年MM月").format(tBlog.getCreateTime()).toString();
        System.out.println(month);

        System.out.println("--------------------------------------------------------------");
//        request.setAttribute("month",month);
//        Set<String> monthSet = new TreeSet<>();
//        monthSet.add(month);
        return tBlog;
    }

//    @Override
//    public List<Timestamp> findAllYearAndMonth() {
//        List<Timestamp> allYearAndMonth = archiveMapper.findAllYearAndMonth();
//        return allYearAndMonth;
//    }
}
